﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Shapes;
using System.Windows;
using System.ComponentModel;
using DiagramCreator.Nodes;
using System.Windows.Media;
using System.Windows.Controls;

namespace DiagramCreator.Arrows
{
    public class ConnectionLineForNote : GenericConnectionLine
    {
        #region - InternalDrawArrowGeometry -

        protected override void InternalDrawArrowGeometry(StreamGeometryContext context)
        {
            double theta = Math.Atan2(Y1 - Y2, X1 - X2);
            double sint = Math.Sin(theta);
            double cost = Math.Cos(theta);

            Point pt1 = new Point(X1, this.Y1);
            Point pt2 = new Point(X2, this.Y2);

            //Point pt3 = new Point(
            //    X2 + (HeadWidth * cost - HeadHeight * sint),
            //    Y2 + (HeadWidth * sint + HeadHeight * cost));

            //Point pt4 = new Point(
            //    X2 + (HeadWidth * cost + HeadHeight * sint),
            //    Y2 - (HeadHeight * cost - HeadWidth * sint));
            
            context.BeginFigure(pt1, true, false);
            context.LineTo(pt2, true, true);
            //context.LineTo(pt3, true, true);
            //context.LineTo(pt2, true, true);
            //context.LineTo(pt4, true, true);
        }

        #endregion

        #region - Konstruktor -

        public ConnectionLineForNote(GenericNode p, GenericNode ch) : base(p, ch)
        {
            this.StrokeDashArray.Add(1.0);
            this.StrokeDashArray.Add(1.0);
        }

        #endregion        
    }
}
